package com.shop.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum ExceptionEnum {
    SUCCESS(200, "请求成功"),
    CREATED(201, "资源创建成功"),
    REQUEST_FORMAT(399, "请求格式异常"),
    BAD_REQUEST(400, "请求参数错误"),
    UNAUTHORIZED(401, "未认证"),
    FORBIDDEN(403, "权限不足"),
    NOT_FOUND(404, "资源不存在"),
    METHOD_NOT_ALLOWED(405, "方法不允许"),
    CONFLICT(409, "资源冲突"),
    TOO_MANY_REQUESTS(429, "请求过于频繁"),
    INTERNAL_SERVER_ERROR(500, "服务器内部错误"),
    SERVICE_UNAVAILABLE(503, "服务不可用请稍后再试"),


    // 认证与授权相关 (1000系列)
    INVALID_TOKEN(1001, "令牌无效"),
    EXPIRED_TOKEN(1002, "令牌过期"),
    REFRESH_TOKEN_INVALID(1003, "刷新令牌无效"),
    TOKEN_BLACKLISTED(1004, "令牌验证失败"),
    INSUFFICIENT_PERMISSIONS(1005, "权限不足"),
    ACCOUNT_LOCKED(1006, "账户已被锁定"),
    ACCOUNT_DISABLED(1007, "账户已被禁用"),
    LOGIN_FAILED(1008, "用户或者密码错误"),
    CAPTCHA_INVALID(1009, "验证码无效或已过期"),

    // 用户相关 (2000系列)
    USER_NOT_FOUND(2001, "用户不存在"),
    USERNAME_ALREADY_EXISTS(2002, "用户名已存在"),
    EMAIL_ALREADY_EXISTS(2003, "邮箱已被注册"),
    PHONE_ALREADY_EXISTS(2004, "手机号已被注册"),
    INVALID_OLD_PASSWORD(2005, "旧密码不正确"),
    PASSWORD_EXPIRED(2006, "密码已过期"),
    PROFILE_INCOMPLETE(2007, "用户资料不完整"),
    SIGNED_IN_TODAY(2008, "今日已签到"),

    // 数据与资源相关 (3000系列)
    RESOURCE_NOT_FOUND(3001, "资源不存在"),
    RESOURCE_ALREADY_EXISTS(3002, "资源已存在"),
    RESOURCE_LOCKED(3003, "资源被锁定"),
    RESOURCE_LIMIT_EXCEEDED(3004, "资源超出限制"),
    DATA_VALIDATION_FAILED(3005, "数据验证失败"),
    DATA_CONFLICT(3006, "数据冲突"),
    UPLOAD_FAILED(3007, "上传失败"),
    FILE_TOO_LARGE(3008, "文件过大"),

    // 系统与服务相关 (4000系列)
    REMOTE_SERVICE_ERROR(4002, "远程服务调用失败"),
    CACHE_ERROR(4003, "缓存操作失败"),
    DATABASE_ERROR(4004, "数据库操作失败"),
    RATE_LIMIT_EXCEEDED(4005, "超出限流限制"),
    CONFIG_ERROR(4006, "配置错误"),
    TASK_EXECUTION_FAILED(4007, "任务执行失败");

    private int code;
    private String msg;
}
